package com.ruoyi.project.WebMoudle.advertSeat.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.advertSeat.mapper.AdvertSeatMapper;
import com.ruoyi.project.WebMoudle.advertSeat.domain.AdvertSeat;
import com.ruoyi.project.WebMoudle.advertSeat.service.IAdvertSeatService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 店铺广告位Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-01
 */
@Service
public class AdvertSeatServiceImpl implements IAdvertSeatService 
{
    @Autowired
    private AdvertSeatMapper advertSeatMapper;

    /**
     * 查询店铺广告位
     * 
     * @param id 店铺广告位ID
     * @return 店铺广告位
     */
    @Override
    public AdvertSeat selectAdvertSeatById(Long id)
    {
        return advertSeatMapper.selectAdvertSeatById(id);
    }

    /**
     * 查询店铺广告位列表
     * 
     * @param advertSeat 店铺广告位
     * @return 店铺广告位
     */
    @Override
    public List<AdvertSeat> selectAdvertSeatList(AdvertSeat advertSeat)
    {
        return advertSeatMapper.selectAdvertSeatList(advertSeat);
    }

    /**
     * 新增店铺广告位
     * 
     * @param advertSeat 店铺广告位
     * @return 结果
     */
    @Override
    public int insertAdvertSeat(AdvertSeat advertSeat)
    {
        return advertSeatMapper.insertAdvertSeat(advertSeat);
    }

    /**
     * 修改店铺广告位
     * 
     * @param advertSeat 店铺广告位
     * @return 结果
     */
    @Override
    public int updateAdvertSeat(AdvertSeat advertSeat)
    {
        return advertSeatMapper.updateAdvertSeat(advertSeat);
    }

    /**
     * 删除店铺广告位对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdvertSeatByIds(String ids)
    {
        return advertSeatMapper.deleteAdvertSeatByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除店铺广告位信息
     * 
     * @param id 店铺广告位ID
     * @return 结果
     */
    @Override
    public int deleteAdvertSeatById(Long id)
    {
        return advertSeatMapper.deleteAdvertSeatById(id);
    }

    @Override
    public String checkNumUnique(AdvertSeat advertSeat) {
        AdvertSeat as= advertSeatMapper.checkNumUnique(advertSeat);
        if (as==null){
            return "0";
        }
        return "1";
    }

    @Override
    public List<AdvertSeat> queryUsableSeat(String startTime, String endTime) {
        return advertSeatMapper.queryUsableSeat(startTime,endTime);
    }
}
